home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / strlib.zip / STRCSPN.C < prev    next >
Text File  |  1993-01-04  |  768b  |  27 lines

  1.  
  2. /*  File   : strcspn.c
  3.     Author : Richard A. O'Keefe.
  4.     Updated: 11 April 1984
  5.     Defines: strspn()
  6.  
  7.     strcspn(s1, s2) returns the length  of  the  longest  prefix  of  s1
  8.     consisting  entirely  of  characters  which  are  NOT  in s2 ("c" is
  9.     "complement").  NUL is considered to be part  of  s2.   As  _str2set
  10.     will never include NUL in a set, we have to check for it explicitly.
  11. */
  12.  
  13. #include "strings.h"
  14. #include "_str2set.h"
  15.  
  16. int strcspn(str, set)
  17.     register _char_ *str;
  18.     char *set;
  19.     {
  20.         register int L;
  21.  
  22.         _str2set(set);
  23.         for (L = 0; *str && _set_vec[*str++] != _set_ctr; L++) ;
  24.         return L;
  25.     }
  26.  
  27.